package com.ujiuye.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/verify")
public class VerifyServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       req.setCharacterEncoding("utf-8");
        String name = req.getParameter("name");
        String date = req.getParameter("date");
        System.out.println(name+"="+date);
        boolean bo=true;
        if ("tom".equals(name)){//表示数据库中存在该用户名，返回true
            bo=true;
        }else {//否则返回false
            bo=false;
        }
        PrintWriter pw=resp.getWriter();
        pw.print(bo);
        pw.close();
    }
}
